// Render Operation
// (c) jimon game studio

#ifndef JEH_JERENDEROPERATION
#define JEH_JERENDEROPERATION

#include "jeTypes.h"
#include "jeUnknown.h"
#include "jeStl.h"
#include "IHardwareBufferArray.h"

namespace je
{
	namespace video
	{
		//! Render Operation Type
		enum RenderOperationType
		{
			//! Draw Points
			//! Each vertex is a point
			ROT_DRAW_POINTS,

			//! Draw Lines
			//! Pair of vectors is a line
			ROT_DRAW_LINES,

			//! Draw Triangles
			ROT_DRAW_TRIANGLES,

			//! Draw Triangle Strip
			ROT_DRAW_TRIANGLE_STRIP,

			//! Draw Quad
			//! if we need to draw only one quad we need to create vbo, create ro and other stuff
			//! by ROT_DRAW_QUAD render use precreated vbo
			ROT_DRAW_QUAD
		};

		//! Render Operation
		class jeRenderOperation:public je::jeUnknown
		{
		public:
			//! Destructor
			virtual ~jeRenderOperation()
			{
			}
		};

		//! Render Operation
		class jeRenderOperation_Draw:public je::video::jeRenderOperation
		{
		public:
			//! Vertex Buffer
			IHardwareBufferArray * Array;

			//! Draw Size
			s32 DrawSize;

			//! Draw Offset
			s32 DrawOffset;

			//! Constructor
			jeRenderOperation_Draw()
				:Array(NULL),DrawSize(-1),DrawOffset(0)
			{
			}

			//! Destructor
			~jeRenderOperation_Draw()
			{
				if(Array)
					Array->Drop();
			}

			//! Set Array
			void SetArray(IHardwareBufferArray * BufferArray)
			{
				if(Array)
					Array->Drop();
				Array = BufferArray;
				if(Array)
					Array->Grab();
			}
		};
	};
};

#endif
